# thisdict = {
#     "brand": "Porsche",
#     "model": "911",
#     "year": 1963,
#     0 : 1
# }
# print(thisdict)
#
# print(thisdict['model'])
# print(thisdict.get('model'))
#
# print(thisdict[0])
#
# if "model" in thisdict:
#     print("Yes, 'model' is one of the keys in the thisdict dictionary")

# condition = True
# condition1 = False
#
# if condition:
#     pass
#
#
# if condition:
#     pass
#     if condition1:
#         pass
# else:
#     pass
#
#
# if condition:
#     pass
# elif condition1:
#     pass
# elif condition1:
#     pass
# elif condition1:
#     pass
# elif condition1:
#     pass
# else:
#     pass
#
#
# a = 66
# b = 200
# if b > a:
#     print("b is greater than a")
#
#
# if a > 0 and a < 100:
#     print('ok')
#
# a = 200
# b = 66
# if a > b:
#     print("a is greater than b")
#
# print("A") if a > b else print("B")
#
# if a > b:
#     print("A")
# else:
#     print("B")
#
#
# s = 'A' if a > b else 'B'
#
# if a > b:
#     s = 'A'
# else:
#     s = 'B'

# a = 200
# b = 66
# c = 500
# if (a > b and not c > a) or b > c:
#     # print("Both conditions are True")
#     pass
# else:
#     print('aaa')


# i = 1
# while i < 7:
#     print(i)
#     i += 1
#
# print()
# print(i)

# i = 1
# while i < 7:
#     print(i)
#     if i == 3:
#         break
#     i += 1

# i = 0
# while i < 7:
#     i += 1
#     if i == 3:
#         continue
#     print(i)


# fruits = ["apple", "banana", "cherry"]
# for x in fruits:
#     print(x)

# fruits = ["apple", "banana", "cherry"]
# for x in fruits:
#     if x == "banana":
#         break
#     print(x)
#
# for x in fruits:
#     if x == "banana":
#         continue
#     print(x)

# for x in fruits:
#     fruits.pop()
#     print(x)


# for x in range(10):
#     print(x)
#
# print(range(10))

# xx = range(10)
# for x in xx:
#     print(x)
#     break
#
# print(list(xx))

# fruits = ["apple", "banana", "cherry"]
# for x in range(len(fruits)):
#     print(x)


# for x in range(3, 52, 6):
#     print(x)


# for x in range(5):
#     print(x)
#     break
# else:
#     print("Finally finished!")

# fruits = {"apple", "banana", "cherry"}
# for x in fruits:
#     print(x)

# thisdict = {
#     "brand": "Porsche",
#     "model": "911",
#     "year": 1963
# }
# for x, y in thisdict.items():
#     print(x, ': ', y)

# fruits = ["apple", "banana", "cherry"]
# for i, x in enumerate(fruits):
#     print(x*(i+1))

def plus2(num):
    return num + 2


# # define
#
# n = plus2(3)
# print(n)
# print(plus2(3))


# def my_function(fname):
#     print(fname + " Gates")
#
#
# my_function("Rory John")
# my_function("Jennifer Katharine")
# my_function("Phoebe Adele")

# def my_function(country="China"):
#     print("I am from " + country)
#
#
# my_function("Sweden")
# my_function("India")
# my_function()
# my_function("Brazil")

# def my_function(child3, child2, child1):
#     print("The youngest child is " + child3)
#
#
# my_function(child1="Phoebe", child2="Jennifer", child3="Rory")


# def my_function(*kids, **nnn):
#     print(type(kids))
#     print(type(nnn))
#     print("The youngest child is " + kids[1])
#
#
# my_function("Phoebe", "Jennifer", na="Rory", ch='111')


# def tri_recursion(k):
#     if k > 0:
#         result = k + tri_recursion(k - 1)
#         print(result)
#     else:
#         result = 0
#     return result
#
#
# print("\n\nRecursion Example Results")
# tri_recursion(6)

# tri_recursion(6)
# = 6 + tri_recursion(5)
# = 11 + tri_recursion(4)
# = 15 + tri_recursion(3)
# = 18 + tri_recursion(2)
# = 20 + tri_recursion(1)
# = 21 + tri_recursion(0)
# = 21


# def factor(n):
#     if n == 0:
#         return 1
#     else:
#         return n * factor(n-1)
#
#
# print(factor(6))


# def fib(n):
#     if n == 1 or n == 2:
#         return 1
#     else:
#         return fib(n-1) + fib(n-2)
#
#
# print(fib(10))
# 尾递归
# 记录中间过程


# def g(a):
#     return a + 10
#
#
# f = lambda a: a + 10
#
# print(f(5))
# print(g(5))
# print((lambda a: a + 10)(5))
#
#
# def comp(f, g, x):
#     return f(g(x))
#
#
# print(comp(f, g, 2))
